<?php


/**
 * 监控服务
 */
class Server
{
	const PORT = '50271';

	public function port(){
		$shell = 'netstat -anp | grep '.self::PORT.' | grep LISTEN | wc -l';
		$flag = shell_exec($shell);

		if($flag == 1){
			echo 'status enable'.PHP_EOL;
		}else{
			echo 'status disable'.PHP_EOL;
		}
	}

}

swoole_timer_tick(5000, function () {
    
	(new Server())->port();

});
